<?php
/**
 * @property Job             $Job
 * @property JobGroupAltName $JobGroupAltName
 * 
 */
class JobGroup extends AppModel {
	
  var $name = 'JobGroup';
  var $displayField = 'name';
	
  // These must be set so that AppModel::removeBlankOptionalFields()  can do it's job.
  //   (this is inherited from AppModel)
  var $optionalAssocModelsAndFields = array('JobGroupAltName'=>'name');
  
  
  
  // VALIDATE ARRAY
  var $validate = array(
      
		'name' => array(
        'notempty' => array(
          'rule' => array('notempty'),
          'message' => 'This value cannot be empty.',
          //'allowEmpty' => false,
          //'required' => false,
          //'last' => false, // Stop validation after this rule
          //'on' => 'create', // Limit validation to 'create' or 'update' operations
        ),
        'maxlength' => array(
          'rule' => array('maxlength', 128),
          'message' => 'Maximum length of this field is 128.',
          //'allowEmpty' => false,
          //'required' => false,
          //'last' => false, // Stop validation after this rule
          //'on' => 'create', // Limit validation to 'create' or 'update' operations
        ),
        'isUnique' => array(
            'rule' => 'isUnique',        
            'message' => 'This value has already been taken. Please choose something unique.'
        )
		),
    'dir_abs_path' => array(
        'notempty' => array(
          'rule' => array('notempty'),
          'message' => 'This value cannot be empty.',
          //'allowEmpty' => false,
          //'required' => false,
          //'last' => false, // Stop validation after this rule
          //'on' => 'create', // Limit validation to 'create' or 'update' operations
        ),
        'maxlength' => array(
          'rule' => array('maxlength', 512),
          'message' => 'Maximum length of this field is 512.',
          //'allowEmpty' => false,
          //'required' => false,
          //'last' => false, // Stop validation after this rule
          //'on' => 'create', // Limit validation to 'create' or 'update' operations
        )
    )      
	);
	

  // ASSOCIATIONS
  //The Associations below have been created with all possible keys, those that are not needed can be removed

  var $hasOne = array (
    'JobGroupAltName' => array(
			'className' => 'JobGroupAltName',
			'foreignKey' => 'job_group_id',
      'dependent'    => true,   // When a job group gets deleted, also delete it's Alt Name  
			'conditions' => '',
			'fields' => '',
			'order' => ''
		) 
  );
  
	var $hasMany = array(
      
		'Job' => array(
			'className' => 'Job',
			'foreignKey' => 'job_group_id',
      'dependent'    => true,   // When a job group gets deleted, also delete it's jobs
			//'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		)
	);

}
